﻿<!--***********************************************************************************

   AvalonDock

   Copyright (C) 2007-2013 Xceed Software Inc.

   This program is provided to you under the terms of the New BSD
   License (BSD) as published at http://avalondock.codeplex.com/license 

   For more features, controls, and fast professional support,
   pick up AvalonDock in Extended WPF Toolkit Plus at http://xceed.com/wpf_toolkit

   Stay informed: follow @datagrid on Twitter or Like facebook.com/datagrids

  **********************************************************************************-->

<Window x:Class="AvalonDock.TestApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"
        xmlns:local="clr-namespace:AvalonDock.TestApp"
        xmlns:winformsIntegration="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
        Title="MainWindow" Height="350" Width="525">
    <Grid x:Name="layoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Menu Grid.Row="0">
            <MenuItem Header="Edit">
                <MenuItem Command="Undo" />
                <MenuItem Command="Redo" />
                <Separator/>
                <MenuItem Command="Cut" />
                <MenuItem Command="Copy" />
                <MenuItem Command="Paste" />
            </MenuItem>
            <MenuItem Header="Layout">
                <MenuItem Header="Save">
                    <MenuItem Header="Layout_1" Click="OnSaveLayout"/>
                    <MenuItem Header="Layout_2" Click="OnSaveLayout"/>
                    <MenuItem Header="Layout_3" Click="OnSaveLayout"/>
                    <MenuItem Header="Layout_4" Click="OnSaveLayout"/>
                </MenuItem>
                <MenuItem Header="Load">
                    <MenuItem Header="Layout_1" Click="OnLoadLayout"/>
                    <MenuItem Header="Layout_2" Click="OnLoadLayout"/>
                    <MenuItem Header="Layout_3" Click="OnLoadLayout"/>
                    <MenuItem Header="Layout_4" Click="OnLoadLayout"/>
                </MenuItem>
                <MenuItem Header="Dump To Console" Click="OnDumpToConsole"/>
                <MenuItem Header="Unload Manager" Click="OnUnloadManager"/>
                <MenuItem Header="Load Manager" Click="OnLoadManager"/>
            </MenuItem>
            <MenuItem Header="Tools">
                <MenuItem Header="WinForms Window" Click="OnShowWinformsWindow"/>
                <MenuItem Header="Tool Window1" Click="OnShowToolWindow1"/>
            </MenuItem>
        </Menu>

        <avalonDock:DockingManager Grid.Row="1" x:Name="dockManager" AllowMixedOrientation="True" DocumentClosing="dockManager_DocumentClosing">
            <avalonDock:DockingManager.Theme>
                <avalonDock:MetroTheme/>
            </avalonDock:DockingManager.Theme>
            <avalonDock:DockingManager.DocumentHeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{Binding IconSource}" Margin="0,0,4,0"/>
                        <TextBlock Text="{Binding Title}" TextTrimming="CharacterEllipsis"/>
                    </StackPanel>
                </DataTemplate>
            </avalonDock:DockingManager.DocumentHeaderTemplate>
            <avalonDock:LayoutRoot PropertyChanged="OnLayoutRootPropertyChanged">
                <avalonDock:LayoutPanel Orientation="Horizontal">
                    <avalonDock:LayoutAnchorablePane DockWidth="100">
                        <avalonDock:LayoutAnchorable x:Name="WinFormsWindow"  ContentId="WinFormsWindow" Title="WinForms Window" ToolTip="My WinForms Tool" CanHide="False" CanClose="False" >
                            <winformsIntegration:WindowsFormsHost x:Name="winFormsHost" Background="White"/>
                        </avalonDock:LayoutAnchorable>
                    </avalonDock:LayoutAnchorablePane>
                    <avalonDock:LayoutDocumentPaneGroup>
                        <avalonDock:LayoutDocumentPane>
                            <avalonDock:LayoutDocument ContentId="document1" Title="Document 1" IconSource="/AvalonDock.TestApp;component/Images/alarm-clock-blue.png" >
                                <StackPanel>
                                    <TextBox Text="Document 1 Content"/>
                                    <Button Content="Click to add 2 documents" Click="AddTwoDocuments_click"/>
                                </StackPanel>
                            </avalonDock:LayoutDocument>
                            <avalonDock:LayoutDocument ContentId="document2" Title="Document 2">
                                <TextBox Text="{Binding TestTimer, Mode=OneWay, StringFormat='Document 2 Attached to Timer ->\{0\}'}"/>
                            </avalonDock:LayoutDocument>
                        </avalonDock:LayoutDocumentPane>
                    </avalonDock:LayoutDocumentPaneGroup>
                    <avalonDock:LayoutAnchorablePaneGroup DockWidth="150">
                        <avalonDock:LayoutAnchorablePane>
                            <avalonDock:LayoutAnchorable ContentId="toolWindow1" Title="Tool Window 1" Hiding="OnToolWindow1Hiding">
                                <StackPanel>
                                    <local:TestUserControl/>
                                    <TextBox Text="{Binding TestTimer, Mode=OneWay, StringFormat='Tool Window 1 Attached to Timer ->\{0\}'}"/>
                                </StackPanel>
                            </avalonDock:LayoutAnchorable>
                            <avalonDock:LayoutAnchorable ContentId="toolWindow2" Title="Tool Window 2">
                                <TextBlock Text="{Binding FocusedElement}"/>
                            </avalonDock:LayoutAnchorable>
                        </avalonDock:LayoutAnchorablePane>
                    </avalonDock:LayoutAnchorablePaneGroup>
                </avalonDock:LayoutPanel>

                <avalonDock:LayoutRoot.LeftSide>
                    <avalonDock:LayoutAnchorSide>
                        <avalonDock:LayoutAnchorGroup>
                            <avalonDock:LayoutAnchorable Title="AutoHide1 Content" ContentId="AutoHide1Content" IconSource="/AvalonDock.TestApp;component/Images/address-book--pencil.png" >
                                <TextBox Text="{Binding TestTimer, Mode=OneWay, StringFormat='AutoHide Attached to Timer ->\{0\}'}"/>
                            </avalonDock:LayoutAnchorable>
                            <avalonDock:LayoutAnchorable Title="AutoHide2 Content" ContentId="AutoHide2Content">
                                <StackPanel Orientation="Vertical">
                                    <TextBox/>
                                    <TextBox/>
                                </StackPanel>
                            </avalonDock:LayoutAnchorable>
                        </avalonDock:LayoutAnchorGroup>
                    </avalonDock:LayoutAnchorSide>
                </avalonDock:LayoutRoot.LeftSide>
            </avalonDock:LayoutRoot>
        </avalonDock:DockingManager>
    </Grid>
</Window>
